package cn.shop.admin.entity.backRoleModule;

import cn.shop.base.BaseEntity;
import cn.shop.utils.constant.Regular;
import cn.shop.validation.Save;
import cn.shop.validation.Update;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 角色表(BackRole)表实体类
 *
 * @author jzw
 * @since 2021-11-17 11:42:45
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class BackRole extends BaseEntity {

	private static final long serialVersionUID = -4566813800603981072L;

	/**
	 * 角色简称
	 */
	@Pattern(regexp = Regular.ROLE, message = Regular.ROLE_MASSAGE, groups = {Save.class, Update.class})
	@NotNull(message = "角色标识不能为空", groups = Save.class)
	private String code;

	/**
	 * 角色名称
	 */
	@TableField(condition = SqlCondition.LIKE)
	@NotNull(message = "角色名称不能为空", groups = Save.class)
	@Length(max = 10, groups = {Save.class, Update.class})
	private String name;

	/**
	 * 角色描述
	 */
	private String description;

	/**
	 * 是否为内置角色
	 */
	private Boolean initial;

	/**
	 * 是否为启用
	 */
	private Boolean enable;

	/**
	 * 是否为内置角色
	 */
	private Boolean def;

}

